use crate::warp_apis::{login, online_users, register,search_users,upload_file};
use warp::Filter;
pub async fn run() {
    let cors = warp::cors()
        .allow_any_origin()
        .allow_methods(vec!["GET", "POST", "PUT", "DELETE", "OPTIONS"]);
    let download_files = warp::path("files")
        .and(warp::fs::dir("./uploads"));
    let apis = login().or(register()).or(online_users()).or(search_users()).or(upload_file()).or(download_files);
    let route =apis.with(cors);
     warp::serve(route).run(([127, 0, 0, 1], 3030)).await
}